<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>装维人员管理</title>
	
	<link rel="stylesheet" type="text/css" href="ui/style.css">	
    <link href="ui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="ui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="ui/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="ui/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="ui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="ui/common.js"></script>
    <script src="ui/plugins/jquery.watermarkinput.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="datepicker/WdatePicker.js" defer="defer"></script>
	
	<script language="javascript" type="text/javascript">
	    $(document).ready(function () {	    	
	    	var area = '<s:property value="#session.user.role"  escape="false"/>';
	    	var url;
	        $("#grid").datagrid({
	            url: "Ryxx.action",
	            queryParams:{
	            	area:area,
	            	act:'list'
	            },
	            type: "post",
	            datatype: "json",
	            title:"装维人员信息管理",
	            iconCls:"icon-people",
	            border:false,
	            pageSize:20,
	            loadMsg: "数据加载中，请稍后...",
	            fitCloumns: false,
	            nowrap: false,
	            stripe:true,
	            fit: true,//自动大小
	            rownumbers:true,//行号
	            pagination: true,
	            singleSelect: true,	
	            toolbar:"#tb",            
			    frozenColumns:[[  			        
                    { field: 'dw', title: '单位', width:50},
                    { field: 'xm', title: '姓名', width:50}
			    ]]
	        });
	    });
	    
	    function openQueryDialog(){
	    	$("#grid").datagrid('load');
            $('#queryDialog').dialog('open');
	    }
	    $(function(){
			$('#exportDialog').dialog({				
				title:"导出到Excel",
				modal:true,
				closed:true
			});	
			$('#queryDialog').dialog({				
				title:"查询",
				modal:true,
				closed:true
			});	
			$("#queryName").Watermark("请输入人员姓名");	
		});
		
		function ExportExcel(){
			if($('#exportForm').form('validate')==true){
				$('#exportForm').submit();
				$('#exportDialog').dialog('close');
				//表单复位
				$( "#exportForm" )[ 0 ].reset();
				$.messager.show({  
	                title: '信息',  
	                msg: "正在导出，请稍候……"  
	            });
	        }else{
	        	$.messager.alert('请注意','请选择要导出的地区！','warning');
	        }
		}
		function resetForm(){
			$( "#addForm" )[ 0 ].reset();
		}
		function Query(){
			//$("#grid").datagrid('load');			
			if($('#queryForm').form('validate')==true){				
				var queryParams = $('#grid').datagrid('options').queryParams;
				queryParams.queryName = $('#queryName').val();
				queryParams.area = $('#queryArea').val();
				queryParams.act = "query";			
			  	$('#grid').datagrid({
			   		url:'Ryxx.action'
			  	});			  	
			  	$('#queryDialog').window('close');
			}
		}
	    function GoEnterPage() {
	        var e = jQuery.Event("keydown");
	        e.keyCode = 13;
	        $("input.pagination-num").trigger(e);
	    }	    
	    function openDialog(dialog,act){
	    	if(act=='add'){
		    	$('#'+dialog).dialog('open').dialog('setTitle','添加人员信息'); 
			    $( "#addForm" )[ 0 ].reset();
			    url = 'addRyxx.action'; 
			}
			if(act=='edit'){
				var select = $('#grid').datagrid('getSelected');
				if(select){
					var row = $('#grid').datagrid('getSelected');  
					if (row){  
					    $('#'+dialog).dialog('open').dialog('setTitle','编辑人员信息');  
					    $('#addForm').form('load',row);  
					    url = 'editRyxx.action?id='+row.id;  
					}
				}else{
					$.messager.alert('请注意','请选择要编辑的行！','warning');
				}  
			}
	    }
	    function saveRyxx(){
	    	//alert(url);  
		    $('#addForm').form('submit',{  
		        url: url,  
		        onSubmit: function(){  
		        	//校验表单
		        	if($('#addForm').form('validate')==true){
			        	if($('#bm_xc').val()==""&&$('#bm_zj').val()==""){
			        		$.messager.alert('注意','部门名称和支局名称不能全部为空！','warning');
			                return false;
			        	}else{
			            	return true;
			            }
			         }else{
			         	return false;
			         }
		        },  
		        success: function(result){
		        	//alert(result);  
		            var result = eval('('+result+')');  
		            if (result.success){ 
		            	$.messager.show({  
		                    title: '信息',  
		                    msg: result.message  
		                }); 
		            	$('#addDialog').dialog('close');      // close the dialog  
		           		$('#grid').datagrid('reload');    // reload the user data  
		            } else {  
		                $.messager.show({  
		                    title: '信息',  
		                    msg: result.message  
		                });
		            }  
		        } 
		    });
		}
		
		function removeRyxx(){  
		    var row = $('#grid').datagrid('getSelected');  
		    if (row){  
		        $.messager.confirm('确认','确定要删除这条信息吗？',function(r){  
		            if (r){  
		                $.post('removeRyxx.action',{id:row.id},function(result){ 
		                	//alert(result.success);
		                	
		                    if (result.success){  
		                    	$.messager.show({   // show error message  
		                            title: '信息',  
		                            msg: result.message 
	                            }); 
		                        $('#grid').datagrid('reload');    // reload the user data  		                        
		                    } else {  
		                        $.messager.show({   // show error message  
		                            title: '信息',  
		                            msg: result.message  
		                        });  
		                    }  
		                },'json');  
		            }  
		        });  
		    }else{
				$.messager.alert('请注意','请选择要删除的行！','warning');
			}			 
		}
	</script>
	
  </head>
  
  <body runat="server">
    <table id="grid">
    	<thead>  
	        <tr>  
	            <th field="xb" width="40">性别</th>  
	            <th field="bm_xc" width="180">部门名称</th>  
	            <th field="bm_zj" width="150">支局名称</th>  
	            <th field="rysx" width="60">人员属性</th>  
	            <th field="dwgsmc" width="150">代维公司名称</th>  
	            <th field="gznr" width="160">工作内容</th> 
	            <th field="sfbzz" width="100">是否班组长</th>  
	            <th field="fdfj" width="60">分等分级</th> 
	            <th field="fwyhs" width="90">服务固网用户数</th> 、
	            <th field="fwyhs_kd" width="90">服务宽带用户数</th>  
	            <th field="fwyhs_itv" width="90">服务ITV用户数</th>
	            <th field="xl" width="40">学历</th>  
	            <th field="sfzh" width="150">身份证号</th>
	            <th field="csrq" width="100">出生日期</th> 	             
	            <th field="sjhm" width="100">手机号码</th>  
	            <th field="zwjndj" width="90">装维技能等级</th> 
	            <th field="ftthjndj" width="90">FTTH技能等级</th>	            
	            <th field="zt" width="40">状态</th> 
	            <th field="rzsj" width="80">入职时间</th> 
	            <th field="lzsj" width="80">离职时间</th>
	            <th field="ry" width="200">荣誉</th> 
	            <th field="bz" width="200">备注</th> 
	        </tr>  
	    </thead>
    </table>
    <div id="tb">  
	    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:openDialog('addDialog','add');return false;">新增</a>  
	    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="javascript:openDialog('addDialog','edit');return false;">修改</a>
	    <s:if test="%{#session.user.role=='全区'}">  
	    	<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:removeRyxx();return false;">删除</a> 
	    </s:if>
	    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="javascript:openQueryDialog();return false;">查询</a>  
	    <a href="#" class="easyui-linkbutton" iconCls="icon-excel" plain="true" onclick="javascript:$('#exportDialog').dialog('open');return false;">导出</a>   
	</div> 
    <div id="addDialog" class="easyui-dialog" style="width:750px;height:390px;padding:10px 10px;overflow:hidden;margin:auto"  
        closed="true" buttons="#dlg-buttons"> 
	    <form id="addForm" method="post">  
	    	<table width="700px" border="0"  cellpadding="0" cellspacing="0">
	    	  <tr>
			    <td width="112px" height="30px"><div align="right"> <font color="red">*</font><label>单位：</label></div></td>
			    <td width="140px">				    		    	
			    	<select name="dw" style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<s:if test="%{#session.user.role=='全区'}">
			    		<option value="市区">市区</option>
			    		<option value="亭湖">亭湖</option>
			    		<option value="盐都">盐都</option>
			    		<option value="东台">东台</option>
			    		<option value="大丰">大丰</option>
			    		<option value="射阳">射阳</option>
			    		<option value="建湖">建湖</option>
			    		<option value="阜宁">阜宁</option>
			    		<option value="滨海">滨海</option>
			    		<option value="响水">响水</option>
			    	</s:if>
			    	<s:else>
			    		<option value="<s:property value="#session.user.role" escape="false"/>"><s:property value="#session.user.role"   escape="false"/></option>
			    	</s:else>
			    	</select>
			    </td>
			    <td width="119px"><div align="right"><font color="red">*</font> <label>姓名：</label></div></td>
			    <td width="140px">
			    	<input type="text" name="xm" style="width:95%" class="easyui-validatebox" >
				</td>
			    <td width="98px"><div align="right"><font color="red">*</font><label>性别：</label></div></td>
			    <td colspan="2" width="89px">
			    	<select name="xb" style="width:100%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="男">男</option>
			    		<option value="女">女</option>
			    	</select>
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><label>部门名称：</label></div></td>
			    <td colspan="2">
			    	<input type="text" id="bm_xc" name="bm_xc"  style="width:95%" class="easyui-validatebox" validType="notAllNull['#bm_zj']">
				</td>
			    <td width="20%"><div align="right"><label>支局名称：</label></div></td>
			    <td colspan="4">
			    	<input type="text" id="bm_zj" name="bm_zj"  style="width:100%" class="easyui-validatebox" validType="notAllNull['#bm_xc']">
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>人员属性：</label></div></td>
			    <td width="20%">
			    	<select name="rysx"  style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="自维">自维</option>
			    		<option value="代维">代维</option>
			    	</select>
				</td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>代维公司名称：</label></div></td>
			    <td colspan="4">
			    	<select name="dwgsmc"  style="width:100%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="无">无</option>
			    		<option value="盐城网盈分公司">盐城网盈分公司</option>
			    	</select>
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>工作内容：</label></div></td>
			    <td width="20%">
			    	<select name="gznr"  style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="无">无</option>
			    		<option value="装维中心主任">装维中心主任</option>
			    		<option value="装维中心副主任">装维中心副主任</option>
			    		<option value="班组长-有生产任务">班组长-有生产任务</option>
			    		<option value="班组长-无生产任务">班组长-无生产任务</option>
			    		<option value="工单管理">工单管理</option>
			    		<option value="兼职工单管理">兼职工单管理</option>
			    		<option value="应急队伍">应急队伍</option>
			    		<option value="支撑经理">支撑经理</option>
			    		<option value="装机">装机</option>
			    		<option value="修障">修障</option>
			    		<option value="维护">维护</option>
			    		<option value="装+维">装+维</option>
			    		<option value="装+修">装+修</option>
			    		<option value="装+修+维">装+修+维</option>
			    		<option value="修+维">修+维</option>
			    		<option value="装+移+修+欠费">装+移+修+欠费</option>
			    		<option value="装+移+修+欠费+营销">装+移+修+欠费+营销</option>
			    	</select>
			    </td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>是否班组长：</label></div></td>
			    <td width="20%">
			    	<select name="sfbzz"  style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="是-有生产任务">是-有生产任务</option>
			    		<option value="是-无生产任务">是-无生产任务</option>
			    		<option value="否">否</option>
			    	</select>
				</td>
			    <td width="14%"><div align="right"><font color="red">*</font><label>分等分级：</label></div></td>
			    <td colspan="2">
			    	<select name="fdfj"  style="width:100%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="无">无</option>
			    		<option value="A">A</option>
			    		<option value="B">B</option>
			    		<option value="C">C</option>
			    	</select>
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>服务固网用户数：</label></div></td>
			    <td width="20%">
			    	<input type="text" name="fwyhs" style="width:95%" class="easyui-validatebox" >
				</td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>服务宽带用户数：</label></div></td>
			    <td width="20%">
			    	<input type="text" name="fwyhs_kd" style="width:95%" class="easyui-validatebox" >
				</td>
			    <td width="14%"><div align="right"><font color="red">*</font><label>服务ITV用户数：</label></div></td>
			    <td colspan="2">
			    	<input type="text" name="fwyhs_itv" style="width:100%" class="easyui-validatebox" >
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>学历：</label></div></td>
			    <td width="20%">
			    	<select name="xl" style="width:95%" class="easyui-validatebox" >
			    	 	<option value="" selected="selected">请选择</option>
			    		<option value="本科">本科</option>
			    		<option value="大专">大专</option>
			    		<option value="中专">中专</option>
			    		<option value="职高">职高</option>
			    		<option value="技校">技校</option>
			    		<option value="高中">高中</option>
			    		<option value="初中">初中</option>
			    		<option value="小学">小学</option>
			    	</select>
				</td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>身份证号：</label></div></td>
			    <td width="20%">
			    	<input type="text" name="sfzh" style="width:95%" class="easyui-validatebox" >
				</td>
			    <td width="14%"><div align="right"><font color="red">*</font><label>手机号码：</label></div></td>
			    <td colspan="2">
			    	<input type="text" name="sjhm" style="width:100%" class="easyui-validatebox" >
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>装维技能等级：</label></div></td>
			    <td width="20%">
			    	<select name="zwjndj" style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="无">无</option>
			    		<option value="高级">高级</option>
			    		<option value="中级">中级</option>
			    		<option value="初级">初级</option>
			    	</select>
				</td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>FTTH技能等级：</label></div></td>
			    <td width="20%">
			    	<select name="ftthjndj" style="width:95%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="无">无</option>
			    		<option value="高级">高级</option>
			    		<option value="中级">中级</option>
			    		<option value="初级">初级</option>
			    	</select>
				</td>
			    <td width="14%"><div align="right"><font color="red">*</font><label>状态：</label></div></td>
			    <td colspan="2">
			    	<select name="zt" style="width:100%" class="easyui-validatebox" >
			    		<option value="" selected="selected">请选择</option>
			    		<option value="在职">在职</option>
			    		<option value="离职">离职</option>
			    		<option value="学员">学员</option>
			    	</select>
			    </td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><font color="red">*</font><label>入职时间：</label></div></td>
			    <td width="20%">
			    	<input name="rzsj" style="width:95%" onClick="WdatePicker({startDate:'2010-01-01',errDealMode:'2'})" class="easyui-validatebox Wdate" />
				</td>
			    <td width="17%"><div align="right"><font color="red">*</font><label>离职时间：</label></div></td>
			    <td width="20%">
			    	<input name="lzsj" style="width:95%" onClick="WdatePicker({startDate:'2010-01-01',errDealMode:'2'})" class="easyui-validatebox Wdate"  value="2099-12-31" />
				</td>
				<td width="14%" height="30px"><div align="right">出生日期：</div></td>
				<td colspan="2">
			    	<input type="text" name="csrq" style="width:100%" />
				</td>
			  </tr>
			  <tr>
			    <td width="16%" height="30px"><div align="right"><label>荣誉：</label></div></td>
			    <td colspan="2">
			    	<input type="text" name="ry" style="width:100%" />
				</td>
			    <td width="20%"><div align="right"><label>备注：</label></div></td>
			    <td colspan="4">
			    	<input type="text" name="bz" style="width:100%" />
				</td>
			  </tr>
			  <tr>
			  	<td colspan="9" align="right" height="30px"><font color="red">*为必填项，部门名称和支局名称选填，不能都为空</font></td>
			  </tr>
	    	</table>
	    </form>  
	</div>  
	<div id="dlg-buttons">    
	    <a href="#" class="easyui-linkbutton" iconCls="icon-reload" onclick="javascript:resetForm();return false;">重置</a> 
	    <a href="#" id="btnSave" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveRyxx();return false;">保存</a> 
	</div>
	<div id="exportDialog" icon="icon-excel" style="padding:5px;width:350px;height:150px;">
		<div style="height:20px;line-height:20px;MARGIN-RIGHT:auto;MARGIN-LEFT:auto;vertical-align:middle;text-align:center;margin-top:40px;">
			<form action="Export" method="post" id="exportForm">
				<font color="red">*</font>
				<select name="area" style="width:150px" class="easyui-validatebox" >
		    		<option value="" selected="selected">请选择地区</option>
		    		<s:if test="%{#session.user.role=='全区'}">
		    		<option value="全区">全区</option>
		    		<option value="市区">市区</option>
		    		<option value="亭湖">亭湖</option>
		    		<option value="盐都">盐都</option>
		    		<option value="东台">东台</option>
		    		<option value="大丰">大丰</option>
		    		<option value="射阳">射阳</option>
		    		<option value="建湖">建湖</option>
		    		<option value="阜宁">阜宁</option>
		    		<option value="滨海">滨海</option>
		    		<option value="响水">响水</option>
		    	</s:if>
		    	<s:else>
		    		<option value="<s:property value="#session.user.role" escape="false"/>"><s:property value="#session.user.role"   escape="false"/></option>
		    	</s:else>
		    	</select>&nbsp;&nbsp;<a href="#" class="easyui-linkbutton" id="btnExport" onclick="javascript:ExportExcel();return false;">导出</a>
	    	</form>
    	</div>
	</div>
	<div id="queryDialog" icon="icon-search" style="padding:5px;width:350px;height:150px;">
		<div style="height:20px;line-height:20px;MARGIN-RIGHT:auto;MARGIN-LEFT:auto;vertical-align:middle;text-align:center;margin-top:40px;">
			<form id="queryForm">
				<select name="area" style="width:80px" id="queryArea" class="easyui-validatebox" >
		    		<option value="" selected="selected">选择地区</option>
		    		<s:if test="%{#session.user.role=='全区'}">
			    		<option value="全区">全区</option>
			    		<option value="市区">市区</option>
			    		<option value="亭湖">亭湖</option>
			    		<option value="盐都">盐都</option>
			    		<option value="东台">东台</option>
			    		<option value="大丰">大丰</option>
			    		<option value="射阳">射阳</option>
			    		<option value="建湖">建湖</option>
			    		<option value="阜宁">阜宁</option>
			    		<option value="滨海">滨海</option>
			    		<option value="响水">响水</option>
			    	</s:if>
			    	<s:else>
			    		<option value="<s:property value="#session.user.role" escape="false"/>"><s:property value="#session.user.role"   escape="false"/></option>
			    	</s:else>
		    	</select>
		    	<input id="queryName" type="text" name="queryName" style="width:150px" class="easyui-validatebox" >
		    	&nbsp;&nbsp;<a href="javascript:void(0);" class="easyui-linkbutton" onclick="javascript:Query();">查询</a>
	    	</form>	    	
    	</div>
	</div>
  </body>
</html>
